package com.woniu.controller.medicalService;

import com.github.pagehelper.PageInfo;
import com.woniu.model.gh.common.Result;
import com.woniu.service.medicalService.IDiseaseMSService;
import com.woniu.model.medicalService.entity.Disease;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

//疾病表
@RestController
@RequestMapping("/medical_service_disease")
public class DiseaseController {

    @Autowired
    private IDiseaseMSService diseaseService;

    //分页 条件查询
    @PostMapping("/findPageByKeyword")
    public Result<PageInfo<Disease>> findPageByKeyword(@RequestBody Map<String, Object> condition) {
        PageInfo<Disease> page = diseaseService.findPageByKeyword(condition);
        return Result.ok(page);
    }

    //添加疾病
    @PostMapping("/save")
    public Result<Void> save(@RequestBody Disease disease) {
        diseaseService.save(disease);
        return Result.ok();
    }

    //删除疾病
    @DeleteMapping("/delete")
    public Result<Void> delete(Long id) {
        diseaseService.removeById(id);
        return Result.ok();
    }

}
